﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class manage_update_psw : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Session["username"] = "sa";
        string username = Session["username"].ToString();
        if (TextBox2.Text.ToString() == TextBox3.Text.ToString())
        {

            DataClassesDataContext db = new DataClassesDataContext();
            var result = from a in db.tb_Admin
                         where a.AdminName == username
                         select a;
            foreach (tb_Admin info in result)
            {
                info.Password = TextBox2.Text.ToString();
            }
            db.SubmitChanges();
            Response.Write("<script>alert('密码修改成功！')</script>");
        }
        else
        {
            Response.Write("<script>alert('两次密码输入不一致！')</script>");
        }
    }
}